home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
090
/
pctjjl86.arc
/
ANIMATE.ARC
/
BYTFRNGE.ASM
< prev
next >
Wrap
Assembly Source File
|
1986-04-17
|
6KB
|
172 lines
; *** Listing 10 ***
;
;This program benchmarks the byte-move driver with automatic
; erasure by a blank fringe.
;Link the byte-move form_driver/erase_form_driver
; module to this program.
;
stack segment para stack 'STACK'
db 512 dup(0)
stack ends
;
one segment para public 'CODE'
assume cs:one,ds:one,es:nothing
extrn form_driver:near
;
iteration_count dw 0 ;will hold # of times to move the objects
;
;Lists describing image, location, and motion of 8 objects.
;
;pointers to form byte strings for each object:
form_address dw f0, f1, f2, f3, f3, f2, f1, f0
;the index for the last object in these lists:
highest_object_pointer equ (($-form_address)-2)
row dw 100,100,100,100,100,100,100,100 ;lines (0 - 198)
column dw 32, 32, 32, 32, 32, 32, 32, 32 ;bytes (0 - 79)
row_increment dw -2, 2, 0, -2, 0, 0, -2, 2 ;lines (0 - 198)
column_increment dw 1, 1, 0, -1, 1, -1, 0, -1 ;bytes (0 - 79)
left_margin dw 0, 0, 0, 0, 0, 0, 0, 0 ;byte # 0-79)
right_margin dw 74, 72, 70, 68, 68, 70, 72, 74 ;byte # (0-79)
top_margin dw 0, 0, 0, 0, 0, 0, 0, 0 ;line # (0 - 198)
bottom_margin dw 190,180,170,160,160,170,180,190 ;line # (0 - 198)
;
;Form byte structures, as follows:
; byte 1: # of scan lines in forms.
; byte 2: # of bytes per scan line of form.
; byte 3: first byte of image, followed by rest of bytes forming
; image, with bytes for top scan line, left to right,
; first, second scan line next, and so on.
;
f0 db 10,6
db 2 dup(6 dup(000h))
db 000h,0f0h,00fh,0f0h,00fh,000h
db 000h,0f0h,03fh,0fch,00fh,000h
db 000h,0ffh,0ffh,0ffh,0ffh,000h
db 000h,0f0h,0ffh,0ffh,00fh,000h
db 000h,0f0h,03fh,0fch,00fh,000h
db 000h,0f0h,00fh,0f0h,00fh,000h
db 2 dup(6 dup(000h))
f1 db 20,8
db 2 dup(8 dup(000h))
db 4 dup(000h,6 dup(055h),000h)
db 4 dup(000h,6 dup(0ffh),000h)
db 4 dup(000h,6 dup(0aah),000h)
db 4 dup(000h,6 dup(055h),000h)
db 2 dup(8 dup(000h))
f2 db 30,10
db 2 dup(10 dup(000h))
db 26 dup(000h,0ffh,0aah,0aah,055h,055h,0aah,0aah,0ffh,000h)
db 2 dup(10 dup(000h))
f3 db 40,12
db 2 dup(12 dup(000h))
db 9 dup(000h,10 dup(0ffh),000h)
db 3 dup(000h,0ffh,0ffh,6 dup(0aah),0ffh,0ffh,000h)
db 3 dup(000h,0ffh,0ffh,0aah,4 dup(055h),0aah,0ffh,0ffh,000h)
db 6 dup(000h,0ffh,0ffh,0aah,055h,0,0,055h,0aah,0ffh,0ffh,000h)
db 3 dup(000h,0ffh,0ffh,0aah,4 dup(055h),0aah,0ffh,0ffh,000h)
db 3 dup(000h,0ffh,0ffh,6 dup(0aah),0ffh,0ffh,000h)
db 9 dup(000h,10 dup(0ffh),000h)
db 2 dup(12 dup(000h))
;
start proc far
push ds ;set up for return to DOS
sub ax,ax ; through the instruction at DS:0 set
push ax ; up by DOS when it loads this program
cld ;the form driver counts up
push cs
pop ds ;DS and CS are to be the same
mov ax,0b800h ;ES is to point to Color Graphics
mov es,ax ; Adapter's memory buffer
mov ax,0004h ;set 320x200 color mode
int 10h ;
;
;Set number of times to move objects
;
;number of times to repeat move loop:
mov [iteration_count],700
;
;For each iteration, move each object in turn by moving
; it one increment and drawing it at the new position.
;
next_iteration:
mov si,highest_object_pointer ;start at last object
;
;Move each object in turn.
;
move_next_object:
;
;Advance the object's row and column and adjust increments
; so the object remains within its boundaries.
;
;If adding the row increment to the row would place it outside
; its margins...
;
mov ax,[si+row] ;test the new line position
add ax,[si+row_increment] ; to see if it goes outside
cmp ax,[si+top_margin] ; its limit
jb negate_row_increment ;if outside negate the
cmp ax,[si+bottom_margin] ; increment so that it will
jbe test_column_increment ; move towards its other limit
;
;...then make the row increment negative if positive and
; positive if negative.
;
negate_row_increment:
neg [si+row_increment] ;make it move in other direction
;
;If adding the column increment to the column would place it
; outside its margins...
;
test_column_increment:
mov ax,[si+column] ;if the column for the object
add ax,[si+column_increment] ; would go outside its left
cmp ax,[si+left_margin] ; or right limits, then
jb negate_column_increment ; negate its increment so
cmp ax,[si+right_margin] ; that it will move in the
jbe add_increments ; opposite direction
;
;...then make the column increment negative if positive and
; positive if negative.
;
negate_column_increment:
neg [si+column_increment] ;set to move in opp. direction
;
;Add the increments to the row and column to arrive at the
; object's next position.
;
add_increments:
mov ax,[si+row_increment] ;calc the next line postion
add [si+row],ax ; and store it
mov ax,[si+column_increment] ;calc the next column postion
add [si+column],ax ; and store it
;
;Draw the object at the new location.
;
push si ;save this object index
mov bx,[si+row] ;find line and column # at
mov cx,[si+column] ; which to place the object
mov si,[si+form_address] ;find the addr. of object's form
call form_driver ;put object's image into screen
pop si ;restore the object index
;
sub si,2 ;point to next object to move
jns move_next_object ; if not done jmp to move it
;
dec [iteration_count] ;count down number of times to
jnz next_iteration ; move all the objects
;
;Reset the mode to 80x25 color text mode.
;
mov ax,0003h ;before returning to DOS,
int 10h ; set screen to 80x25 text mode
;
;Return to DOS.
;
ret ;return though instruction at
; start of PSP set up by DOS
start endp
one ends
end start